﻿#include <iostream>
#include <string>
#include "dll-test.h"

using namespace std;

int main()
{
    std::cout << "Hello World!\n";
}

void Print()
{
    cout << "Hello World" << endl;
}

int GetInt()
{
    return 888;
}

int Add(int a, int b)
{
    return a+b;
}

const char* GetString()
{
    return "hello world";
}

void PrintString(const char* str)
{
    cout << string(str) << endl;
}

InferResult *Infer(const char* f)
{
    InferResult* result = new InferResult();
    result->file_name= new char[strlen(f) + 1];
    const char* tag_name = "test_tag";
    strcpy(result->file_name, f);

    result->recognition_size = 5;
    result->recognition_list = new Recognition[result->recognition_size];
    for (int i = 0; i < result->recognition_size; i++) {
        Recognition& r = result->recognition_list[i];
        r.rect.x = 1 + i;
        r.rect.y = 2 + i;
        r.rect.height = 2;
        r.rect.width = 3;
        r.tag_name = new char[strlen(tag_name) + 1];
        strcpy(r.tag_name, tag_name);
        r.confidence = 0.88;
    }
    result->err = InferError::InferErr;
    return result;
}

void DeleteInferResult(InferResult* infer)
{
    for (int i = 0; i < infer->recognition_size; i++) {
        Recognition& r = infer->recognition_list[i];
        delete r.tag_name;
    }
    delete infer->file_name;
    delete infer;
}